export default function mosaic(
  imageData: ImageData,
  x: number,
  y: number,
  w: number,
  h: number
): ImageData {
  let newImageData = new ImageData(imageData.width, imageData.height)
  for (let i = 0; i < imageData.data.length / 4; i++) {
    let realIndex = i * 4
    newImageData.data[realIndex] = 255 - imageData.data[realIndex]
    newImageData.data[realIndex + 1] = 255 - imageData.data[realIndex + 1]
    newImageData.data[realIndex + 2] = 255 - imageData.data[realIndex + 2]
    newImageData.data[realIndex + 3] = imageData.data[realIndex + 3]
  }
  return newImageData
}
